{% extends "fronted/base.html" %}

{% block main %}
    {% if complete %}
        {% if private.record.status == "CE" %}
            <div class="box box-primary" style="width: 49%; float: left;">
                <div class="box-header with-border"><h3 class="box-title">编译信息</h3></div>
                <div class="box-body table-responsive">
                    <pre>{{ private.result.compile_info }}</pre>
                </div>
            </div>
        {% elif private.record.status == "UKE" %}
            <div class="box box-primary" style="width: 49%; float: left;">
                <div class="box-header with-border"><h3 class="box-title">编译信息</h3></div>
                <div class="box-body table-responsive">
                    <pre>评测机出现错误，请联系管理员</pre>
                </div>
            </div>
        {% else %}
            <div class="box box-primary" style="width: 49%; float: left;">
                <div class="box-header with-border"><h3 class="box-title">分点结果</h3></div>
                <div class="box-body table-responsive">
                    <table class="table table-hover table-condensed">
                        <tbody>
                            <tr>
                                <td>#</td>
                                <td>状态</td>
                                <td>内存(kb)</td>
                                <td>用时(ms)</td>
                            </tr>
                            {% for datapoint in private.result.DataPoints %}
                                <tr>
                                    <td>{{ datapoint.DataNumber }}</td>
                                    <td>{{ datapoint.Status }}</td>
                                    <td>{{ datapoint.Memory }}</td>
                                    <td>{{ datapoint.Time }}</td>
                                </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>
            </div>
        {% endif %}
        <div class="box box-primary" style="width: 49%; float: right;">
            <div class="box-header with-border"><h3 class="box-title">信息</h3></div>
            <div class="box-body table-responsive">
                <table class="table table-hover">
                    <tbody>
                        <tr>
                            <td>提交者</td>
                            <td>{{ private.record.user }}</td>
                        </tr>
                        <tr>
                            <td>题目</td>
                            <td><a href="{{ url_for("fronted.problem_show", problem_id = private.record.prob_id) }}">#{{ private.record.prob_id }} {{ private.record_prob.name }}</a></td>
                        </tr>
                        <tr>
                            <td>提交时间</td>
                            <td>{{ private.record.time }}</td>
                        </tr>
                        <tr>
                            <td>状态</td>
                            <td>{{ private.record.status }}</td>
                        </tr>
                        <tr>
                            <td>得分</td>
                            <td>{{ private.record.score }}</td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <div class="box box-primary" style="width: 100%; float: left;">
            <div class="box-header with-border"><h3 class="box-title">代码</h3></div>
            <div class="box-body table-responsive">
                {{ private.code_html|safe }}
            </div>
        </div>
    {% else %}
        <div class="box box-primary" style="width: 49%; float: left;">
            <div class="box-header with-border"><h3 class="box-title">评测尚未完成，请等待一段时间自行刷新</h3></div>
            <div class="box-body table-responsive">
            </div>
        </div>
        <div class="box box-primary" style="width: 49%; float: right;">
            <div class="box-header with-border"><h3 class="box-title">信息</h3></div>
            <div class="box-body table-responsive">
                <table class="table table-hover">
                    <tbody>
                        <tr>
                            <td>提交者</td>
                            <td>{{ private.record.user }}</td>
                        </tr>
                        <tr>
                            <td>题目</td>
                            <td><a href="{{ url_for("fronted.problem_show", problem_id = private.record.prob_id) }}">#{{ private.record.prob_id }} {{ private.record_prob.name }}</a></td>
                        </tr>
                        <tr>
                            <td>提交时间</td>
                            <td>{{ private.record.time }}</td>
                        </tr>
                        <tr>
                            <td>状态</td>
                            <td>{{ private.record.status }}</td>
                        </tr>
                        <tr>
                            <td>得分</td>
                            <td>{{ private.record.score }}</td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <div class="box box-primary" style="width: 100%; float: left;">
            <div class="box-header with-border"><h3 class="box-title">代码</h3></div>
            <div class="box-body table-responsive">
                {{ private.code_html|safe }}
            </div>
        </div>
    {% endif %}
{% endblock %}